package com.cjm.one.custom.mapper;

import com.cjm.one.model.custom.entity.CustomerLoginLog;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;

/**
* @author 29289
* @description 针对表【customer_login_log(客户登录记录)】的数据库操作Mapper
* @createDate 2024-09-05 16:25:23
* @Entity com.one.model.custom.entity.CustomerLoginLog
*/
public interface CustomerLoginLogMapper extends BaseMapper<CustomerLoginLog> {

    Integer selectRetainedUsers(@Param("start") LocalDateTime start,
                                @Param("end") LocalDateTime end);

    @Select("SELECT COUNT(DISTINCT custom_id) FROM customer_login_log " +
            "WHERE create_time BETWEEN #{start} AND #{end} AND is_deleted = 0")
    Long countActiveUsers(@Param("start") LocalDateTime start,
                          @Param("end") LocalDateTime end);
}




